<?php
$id=$_POST['id']; 
$spend=$_POST['spend']; 
$ddusername=$_POST['ddusername'];
$fangshi=$_POST['fangshi'];
$sj= date("Y-m-d H:i:s");  

$sql="update ".$BIAOTOU."dhdingdan set status=1 where id=".$id." limit 1";
$rs = mysql_query($sql);

$sql="update ".$BIAOTOU."user set dhstate=0 where ddusername='".$ddusername."' limit 1";
$rs = mysql_query($sql);

if($fangshi==1){
    ///发送明细
    $q = "insert into ".$BIAOTOU."mingxi (ddusername,shijian,je,jifen,addtime,memo) values('".$ddusername."','金额兑换','-".$spend."',0,'".$sj."','兑换成功，余额减少".$spend."元')";
    mysql_query($q);
    ///发送站内信
    $q = "insert into ".$BIAOTOU."msg (ddusername,title,see,addtime,senduser,content) values('".$ddusername."','金额兑换','0','".$sj."','网站客服','你兑换的商品已通过审核并兑换成功，余额减少".$spend."元')";
    mysql_query($q);
}
if($fangshi==2){
    ///发送明细
    $q = "insert into ".$BIAOTOU."mingxi (ddusername,shijian,je,jifen,addtime,memo) values('".$ddusername."','积分兑换',0,'-".$spend."','".$sj."','兑换成功，积分减少".$spend."')";
    mysql_query($q);
    ///发送站内信
    $q = "insert into ".$BIAOTOU."msg (ddusername,title,see,addtime,senduser,content) values('".$ddusername."','积分兑换','0','".$sj."','网站客服','你兑换的商品已通过审核并兑换成功，积分减少".$spend."')";
    mysql_query($q);
}
admin_log('确认商品兑换');
alert('兑换确认成功','admin.php?act=duihuan_list');
?>